import request from '@/utils/request'

// 查询商品类别列表
export function listCategory(query) {
  return request({
    url: '/prod-api/product/category/list',
    method: 'get',
    params: query
  })
}
// 查询该等级的商品类别列表
export function listCategoryDepth(depth) {
  return request({
    url: '/prod-api/product/category/depthlist/' + depth,
    method: 'get'
  })
}

// 查询商品类别详细
export function getCategory(categoryUid) {
  return request({
    url: '/prod-api/product/category/' + categoryUid,
    method: 'get'
  })
}

export function selectOptions() {
  return request({
    url: '/prod-api/product/category/selectOptions' ,
    method: 'get'
  })
}

// 新增商品类别
export function addCategory(data) {
  return request({
    url: '/prod-api/product/category',
    method: 'post',
    data: data
  })
}

// 修改商品类别
export function updateCategory(data) {
  return request({
    url: '/prod-api/product/category',
    method: 'put',
    data: data
  })
}

// 修改商品类别状态
export function updateCategoryStatus(categoryUid, dataStatus,categoryDepth,categoryPuid){
  const data = {
    categoryUid:categoryUid,
    dataStatus:dataStatus,
    categoryDepth:categoryDepth,
    categoryPuid:categoryPuid
  }
  return request({
    url: '/prod-api/product/category',
    method: 'put',
    data: data
  })
}

// 修改商品类别状态
export function updateCategoryIsShow(categoryUid, isShow,categoryDepth,categoryPuid){
  const data = {
    categoryUid:categoryUid,
    isShow:isShow,
    categoryDepth:categoryDepth,
    categoryPuid:categoryPuid
  }
  return request({
    url: '/prod-api/product/category',
    method: 'put',
    data: data
  })
}
// 删除商品类别
export function delCategory(categoryUid) {
  return request({
    url: '/prod-api/product/category/' + categoryUid,
    method: 'delete'
  })
}
